Skip to content

Comments

Add support for metadata in TerminalError#646

Open
PfisterFactor wants to merge 1 commit intorestatedev:mainfrom
PfisterFactor:main
Open

Add support for metadata in TerminalError#646
PfisterFactor wants to merge 1 commit intorestatedev:mainfrom
PfisterFactor:main

Conversation

@PfisterFactor
Copy link

@PfisterFactor PfisterFactor commented Feb 19, 2026

From my understanding - the Restate runtime has supported attaching metadata to errors since this commit, but I don't see any of that functionality exposed in the Typescript SDK.

I worked with Claude Code to implement a patch for our own application that would allow attaching metadata to Terminal Errors, and thought I would try to upstream. In our own application this functionality is super useful since we add context to errors when we throw them and it gets lost when being converted to TerminalErrors through ctx.run calls.

Since it is a small fix, I hope it isn't a pain to review - I don't want this to be an AI slop hit and run PR. Let me know if you want me to close this.

Add a `metadata` field (Record<string, string>) to the TerminalError
class, enabling propagation of key-value metadata through the Restate
protocol (requires service protocol v6+).

Changes:
- TerminalError constructor now accepts an optional `metadata` option
- metadata is converted to WasmFailureMetadata format ({key, value}[])
  when sending to the VM via propose_run_completion_failure and
  sys_write_output_failure
- metadata is deserialized back to Record<string, string> when
  receiving Failure completions from the VM

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant